﻿using FitnessCenter.WpfApp.Events;
using Microsoft.Practices.Prism.Commands;
using Microsoft.Practices.Prism.PubSubEvents;
using System.Windows.Input;

namespace FitnessCenter.WpfApp.ViewModels
{
    public class DashboardViewModel : BaseViewModel
    {
        #region Properties

        private string _logActivityLabel;
        public string LogActivityLabel
        {
            get { return _logActivityLabel; }
            set
            {
                if (_logActivityLabel != value)
                {
                    _logActivityLabel = value;
                    OnPropertyChanged();
                }
            }
        }

        private string _addPersonLabel;
        public string AddPersonLabel
        {
            get { return _addPersonLabel; }
            set
            {
                if (_addPersonLabel != value)
                {
                    _addPersonLabel = value;
                    OnPropertyChanged();
                }
            }
        }

        private string _createSubscribtionLabel;
        public string CreateSubscribtionLabel
        {
            get { return _createSubscribtionLabel; }
            set
            {
                if (_createSubscribtionLabel != value)
                {
                    _createSubscribtionLabel = value;
                    OnPropertyChanged();
                }
            }
        }

        private string _activityLabel;
        public string ActivityLabel
        {
            get { return _activityLabel; }
            set
            {
                if (_activityLabel != value)
                {
                    _activityLabel = value;
                    OnPropertyChanged();
                }
            }
        }

        private string _coachesLabel;
        public string CoachesLabel
        {
            get { return _coachesLabel; }
            set
            {
                if (_coachesLabel != value)
                {
                    _coachesLabel = value;
                    OnPropertyChanged();
                }
            }
        }
        #endregion

        #region Commands

        public ICommand SelectModuleCommand { get { return new DelegateCommand<string>(OnSelectModule); } }
        #endregion

        public DashboardViewModel
            (
                IEventAggregator eventAggregator
            )
            : base(eventAggregator)
        {
            Load();
        }

        private void Load()
        {
            LogActivityLabel = "Log Activity";
            AddPersonLabel = "Persons";
            CreateSubscribtionLabel = "Subscribtions";
            ActivityLabel = "Activities";
            CoachesLabel = "Coaches";
        }

        private void OnSelectModule(string moduleName)
        {
            EventAggregator.GetEvent<SelectModuleEvent>().Publish(moduleName);
        }
    }
}
